<template>
  <div class="map-sql-container">
    <variable-define :excel-data="excelData"></variable-define>
  </div>
</template>

<script>
import * as cache from '@/utils/cache';
import VariableDefine from '@/components/VariableDefine.vue'; // 导入组件

export default {
  name: 'MapSql',
  components: {
    VariableDefine // 注册组件
  },
  data() {
    return {
      excelData: [],
      headers: []
    };
  },
  mounted() {
    this.loadFromLocalStorage();
  },
  methods: {
    loadFromLocalStorage() {
      try {
        const excelList = cache.get('excelList');
        if (!excelList || excelList.length === 0) {
          console.warn('No data found in localStorage under key "excelList".');
          return;
        }

        this.excelData = excelList[0];
        console.log('Loaded data from localStorage:', this.excelData);
      } catch (error) {
        console.error('Error loading data from localStorage:', error);
      }
    }
  }
};
</script>

<style scoped>
</style>